package org.pc2r.protocole.message;

import org.pc2r.game.model.Player;
import org.pc2r.game.model.Position;
import org.pc2r.protocole.EnumRequest;
import org.pc2r.protocole.RequestBuilder;

public class YourTurnMessage extends PositionMessage {

	private int nbAction;

	public YourTurnMessage(int x, int y, int nbAction) {
		super(EnumRequest.YOURTURN, new Position(x, y));
		this.nbAction = nbAction;
	}

	public YourTurnMessage(Player player) {
		this(player.getDrone().getX(), player.getDrone().getY(), player
				.getAction());
	}

	@Override
	public String toString() {
	  StringBuilder build = new StringBuilder();
    build.append(getType()).append(RequestBuilder.SEPARATOR);
    build.append(x).append(RequestBuilder.SEPARATOR);
    build.append((char) (y + RequestBuilder.MIN_Y)).append(
        RequestBuilder.SEPARATOR);
		build.append(nbAction).append(RequestBuilder.SEPARATOR).append(RequestBuilder.END);
		return build.toString();
	}

}
